package com.xing.Order.Service.Imp;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xing.Common.Service.CommonService;
import com.xing.Common.Service.Imp.CommonServiceImp;
import com.xing.Order.Service.OrderService;

/**
*@author xingxing
*@version 
*@time 2017年10月19日 下午10:14:17 
*class explain：
*/
@Service("orderService")
public class OrderServiceImp  extends CommonServiceImp implements OrderService {
	@Override
	public int query(String where) {
		String wheres ="where t.address like '%"+where+"%' or t.carno like '%"+where+"%' or t.phoneno like '%"+where+"%' or t.explain like '%"+where+"%'";
		String sql ="SELECT count(*)  FROM T_Customer T "+wheres;		
		return Integer.parseInt(super.createSql(sql).get(0).toString());
	}

	@Override
	public List<?> listpage(String pageno, String pagesize, String search) {
		String where ="where t.address like '%"+search+"%' or t.carno like '%"+search+"%' or t.phoneno like '%"+search+"%' or t.explain like '%"+search+"%'";
		String sql="SELECT * FROM ( SELECT ROWNUM AS LIMITNUM,T.*  FROM T_Order T "+where+" ) WHERE LIMITNUM BETWEEN ("+pageno+"-1)*"+pagesize+" AND "+pageno+"*"+pagesize;	
		return super.createSql(sql);
	}
}
